package com.test.ssm.service.impl;

import com.test.ssm.dao.StudentDao;
import com.test.ssm.pojo.Student;
import com.test.ssm.service.StudentService;
import com.test.ssm.util.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 徒有琴
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao studentDao;

    @Override
    public Student doStudentLogin(String email, String password) {
        Student student = studentDao.getStudentByEmail(email);
        if (student == null || !student.getPassword().equals(DigestUtils.getMD5(password))) {
            return null;
        }
        return student;
    }
}
